package java_book;

class Data{
	int x;
	int y;
}

public class KyungYeon_jv_5_4 {

	public static void sw1 ( int x, int y ) {
		int temp;
		temp = x;
		x = y;
		y = temp;
		
		System.out.println("sw1 x = " + x + ", sw1 y = " + y);
	}
	
	public static void sw2 ( Data data ) {
		int temp;
		temp = data.x;
		data.x = data.y;
		data.y = temp;
		
		System.out.println("sw2 x = " + data.x + ", sw2 y = " + data.y);
	}
	
	public static void main ( String[] args ){
		
		int x = 20;
		int y = 50;
		
		System.out.println("old x = "+x+", old y = "+y);
		sw1(x, y);
		System.out.println("new x = "+x+", new y = "+y);
		
		Data data = new Data();
		data.x = 100;
		data.y = 200;
		System.out.println("old x = "+ data.x+ ", old y = "+ data.y);
		sw2(data);
		System.out.println("new x = "+ data.x+ ", new y = "+ data.y);
		
	}
}
